import numpy as np
import pandas as pd

#创建df
# data = [1,2,3,4,5]
# data = [['Tom',18],['Jerry',19],['Jack',22]]
# df = pd.DataFrame(data,
#                   index=['s1','s2','s3'],
#                   columns=['name','age'])
# print(df)

# data = [{'a': 1, 'b': 2},{'a': 5, 'b': 10, 'c': 20}]
# df = pd.DataFrame(data)
# print(df)

# 常用
# data = {'Name':['Alex','Bob','Lena'],
#         'Age':[18,19,20]}
# df = pd.DataFrame(data)
# print(df)

data = {'Name':pd.Series(['Alex','Bob','Lena'],index=['s1','s2','s3']),
        'Age':pd.Series([18,19],index=['s2','s3'])}
df = pd.DataFrame(data)
# print(df)

# df的基本属性
# print(df.axes)
# print(df.index)
# print(df.columns)
# print(df.dtypes)
print(df.head(1))
print(df.tail(1))
